#ifndef AQTIMEWHEEL_H
#define AQTIMEWHEEL_H

#include <time.h>
#include <vector>
#include <stdio.h>
#include <functional>

namespace TIMEWHEEL
{
    class timer
    {
    public:
        int fd;
        int resvrout;
        int slc;
        std::function<void(int)> func;
        timer *prev; 
        timer *next;
    public:
        timer(int fd, int rout, int slc,std::function<void(int)> funcin);
    };

    
    class timeWheel
    {
    private:
        int sliceNumber;
        int timeInterval;
        int nowslc;       
        std::vector<timer*> slices;
    public:
        timeWheel(int sN,int tI);
        ~timeWheel();

        timer *addTimer(int fd,int timeout,std::function<void(int)> funcin);  
        timer *delTimer(int slc,timer *timer); 

        void beats();                    
    };
}

#endif
